package com.nowcoder.code.lcof;

public class JZ43 {
    public static void main(String[] args) {
        System.out.println(new JZ43().NumberOf1Between1AndN_Solution(0));
    }

    public int NumberOf1Between1AndN_Solution(int n) {



        int sum = 0;
        for (int i = 1; i <= n; i++) {


            int now = i;
            int y;
            while (now != 0) {
                y = now % 10;
                now = now / 10;
                if (y == 1) {
                    sum++;
                }
            }


        }

        return sum;
    }
}
